<template>
  <div class="box">
    <h1>Child{{ index }}</h1>
    <button @click="addCountParent">累加父组件的数据</button>
    <button @click="$emit('click')">child3专属点击按钮</button>
  </div>
</template>

<script>
export default {
  name: "Child",
  props: ["index"],
  methods: {
    addCountParent() {
      this.$emit("changeCount", 1);
    },
  },
};
</script>

<style scoped>
.box {
  background: yellowgreen;
}
</style>
